<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="common/head.jsp" %>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
  <head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="Content-Style-Type" content="text/css">
	<meta http-equiv="Content-Script-Type" content="text/javascript">
	<title>化合物结构式检索</title>
	<link rel="stylesheet" href="${ctx }/common/css/version4.css" type="text/css">
	<link rel="stylesheet" href="${ctx }/common/css/import.css" type="text/css" media="screen,print">
	<link rel="stylesheet" href="${ctx }/common/css/jquery-ui.css" type="text/css">
	<script src="${ctx }/common/js/jquery.js" type="text/javascript"></script>
	<script src="${ctx }/common/js/jquery-ui.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx }/common/js/common.js"></script>
	<script type="text/javascript">
		function readJMECookie() {
			 //var jme = "16 17 C 7.37 -8.99 C 7.37 -7.59 C 6.16 -6.89 C 4.95 -7.59 C 4.95 -8.99 C 6.16 -9.69 N 8.58 -6.89 C 8.58 -5.49 C 7.37 -4.79 O 6.16 -5.49 C 9.80 -7.59 O 9.80 -8.99 C 11.01 -6.89 Cl 12.22 -7.59 Cl 11.01 -5.49 C 9.80 -4.79 1 2 1 2 3 2 3 4 1 4 5 2 5 6 1 6 1 2 7 8 1 8 9 1 9 10 1 3 10 1 2 7 1 7 11 1 11 12 2 11 13 1 13 14 1 13 15 1 8 16 1";
			 var jme ="C:\\Users\\Administrator\\Desktop\\mol\\170530.mol";
	 		// document.JME.readMolecule(jme);
	  		//document.JMEForm.jme.readMolecule(6 6 C 11.14 -4.30 C 7.55 -4.73 C 7.98 -6.06 C 8.68 -3.91 C 9.38 -6.06 C 9.81 -4.73 1 6 1 2 3 1 2 4 1 3 5 1 4 6 1 5 6 1);
		}
		
		function search(type) {
		  if (document.JMEForm.method[0].checked) {
		    document.JMEForm.smiles.value = document.JME.smiles();
		    document.JMEForm.jme.value = document.JME.jmeFile();
		    if(document.JMEForm.jme.value.length == 0){
		    	alert("Please draw a molecule")
		    	return false;
		    }
		  } else {
		    document.JMEForm.smiles.value = document.JMEForm.text.value;
		    if(document.JMEForm.smiles.value.replace(/\s+$/g, "").length == 0){
		    	alert("Please enter a unempty value")
		    	return false;
		    }
		  }
		  document.JMEForm.type.value = type;
		  //alert(document.JMEForm.smiles.value+"------"+document.JMEForm.jme.value)
		  document.JMEForm.submit();
	 	 return true;
		}
  </script>
 </head>
 
 <body id="catalog">
<div class="topHeader">
  <div class="wrap960">
		<!-- 快速链接 S-->
    	<ul class="sg_tits2 fr">
			<li class="noPadd"><a href="javascript:void(0)" onclick="SetHome(this,'http://localhost/chemSearch/');" target="_self">加入收藏</a></li>
		</ul>
<%  
	
	if(session.getAttribute("userLogin")==null){ %>
		<div class="fl" id="loginF">
			<span class="welcome2">用户快速登陆</span>
			<!-- 选择去向 S-->
			<div class="hasGone">
				<form method="post" target="_self" name="login_form" id="login_form" action="${pageContext.request.contextPath}/login.jsp">
				<!-- 登录前显示、登录后隐藏 S-->
				<div class="fl">
					<input class="inp2 w100 colGray" name="user" id="login_user" value="用户名" onfocus="if(this.value == '用户名'){this.value = '';$(this).removeClass('colGray');}" onblur="if(this.value == ''){this.value = '用户名';$(this).addClass('colGray');}" type="text">

                    <input style="display: block;" class="inp2 w85 colGray jsclass_pw_t" value="请输入密码" type="text">
                    <input class="inp2 w85 colGray jsclass_pw_p" name="pwd" id="login_pwd" style="display: none;" type="password">
                    
					<input name="method" value="checktop" type="hidden">
					<input name="returnUrl" id="returnUrl" value="" type="hidden">
					<input name="sign" value="s" type="hidden">
					<input style="display: none;" id="submit" type="submit">
				</div>
				<a href="javascript:void(0);" class="hbtnA" onclick="login();" target="_self" id="btn_login">登录</a>
			    </form>
		  </div>
			<!-- 选择去向 E-->
		</div>
<%}
	else {%>
		<!-- 登陆后状态 S-->
		<div class="fl" id="loginL">
			<!-- 登陆后 -->
			<span class="welcome2" id="welcomeText">您好，欢迎使用化学结构式检索系统</span>
			<!-- 选择去向 S-->
			<div class="hasGone">
			 <form name="Form2" action="${pageContext.request.contextPath}/manage/user/loginOut.do">
				<input type="submit" class="hbtnA" id="logoutBtn" value="退出"/>	  
				<input type= "hidden" name= "url" id= "url" value= "<%=request.getRequestURL()%>">
			</form>
			</div>
			   <!-- 选择去向 E-->
		</div>
	<%}
%>

 </div>
</div>
	<div id="wrapper">
	 <!-- Header Start -->
	<div id="header">
	<a href="#"><img src="${ctx }/common/images/logo1.gif" ></a>
	</div>
	<div id="nav">
    	<a href="${ctx }/search.jsp" class="nav">化合物综合检索</a>  |  
    	<a href="${ctx }/structure_search.jsp" class="nav">化合物结构式检索</a>  |  
        <a href="${ctx }/name_search.jsp" class="nav">化合物名称检索</a>  |  
        <a href="${ctx }/cas_search.jsp" class="nav">CAS号检索</a>  |  
        <a href="${ctx }/formula_search.jsp" class="nav">分子式检索</a>
    </div>
	<div id="main">
	    <h1>化学结构式检索</h1>
	    <h2>请在JME画图区域中进行结构绘制操作！</h2>
	    <br />  
	    <div id="content">
	    <div class="javaaplet" align="center">
	            <applet name="JME" code="JME.class" codebase="${ctx }/applet-classes" archive="JME.jar" width="470" height="312">
	              <param name="options" value="multipart">
	              <param name="jme" value="">
	              <p style="color:#ff0000; font-weight:bold; text-align:center">请使用Java浏览器<br />如您还未安装Java软件，请点击此处下载（免费）。<br /><a href="http://java.com/java/download/index.jsp?cid=jdp101954"><img width="88" height="31" border="0" style="margin:8px" alt="GetJava Download Button" title="GetJava" src="http://java.com/en/img/everywhere/getjava_sm.gif?cid=jdp101954"></a></p>
	            </applet>
	            <p align="center"><a href="http://www.molinspiration.com/jme/">JME Editor</a> courtesy of Peter Ertl, Novartis</p>
	            <p>本查询功能不能区分顺反异构体及对映异构体。<br />例如，绘制R-型的结构并检索后，结果将会是R-型，S-型以及消旋混合物都显示出来</p>
	    </div> 
	    <form name="JMEForm" action="${ctx }/search/structure_search.do" method="post" >
	       <div class="searchDIV" align="center">
	            <p class="result"><span>指定结构式方法</span>
	              <label><input type="radio" name="method" value="0" checked="checked" />JME Editor</label>&nbsp;
				  <label><input type="radio" name="method" value="1" />SMILES</label>&nbsp;
	                     <input type="text" name="text" size="20" value="" onKeyDown="select_smiles();" style="padding:1px 2px; ime-mode:disabled" />
	            </p>
	
	            <p class="result"><span>预设结果显示量</span>
	              <select name="nhits" style="width:50px">
					<option label="15" value="15">15</option>
					<option label="30" value="30">30</option>
					<option label="60" value="60">60</option>
					<option label="90" value="90">90</option>
				  </select>
	
	              <input type="button" value="结构类似检索" onClick="search(2); return false;" class="formbtn_en" style="width:150px" />
	              <input type="button" value="结构片断检索" onClick="search(1); return false;" class="formbtn_en" style="width:150px" />
	              <input type="button" value="结构完全一致检索" onClick="search(3); return false;" class="formbtn_en" style="width:160px" />
	            </p>
	            <input type="hidden" name="smiles" />
	            <input type="hidden" name="jme" />
	            <input type="hidden" name="type" />
	       </div>
	    </form>
	    </div>
	    </div>
	    </div>
	  </body>
</html>